package com.zeus.activiti.web.action;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.zeus.activiti.web.model.UserVO;
import org.apache.struts2.interceptor.SessionAware;
import org.omg.CORBA.PUBLIC_MEMBER;

import java.util.Map;

/**
 * Created by Administrator on 2015/9/3.
 */
public class LoginAction extends ActionSupport implements SessionAware ,ModelDriven<UserVO>{

    private Map<String,Object> session;
    private UserVO userVO = null;

    @Override
    public void setSession(Map<String, Object> session) {
        this.session = session;
    }

    @Override
    public UserVO getModel() {
        if(userVO == null)
            userVO = new UserVO();
        return userVO;
    }

//    @Override
//    public String execute() throws Exception {
//        System.out.println(userVO);
//        session.put("user",userVO);
//        return SUCCESS;
//    }
    public  String login() {
        System.out.println(userVO);
        session.put("user", userVO);
        return SUCCESS;
    }

    public String loginout(){
        session.put("user",null);
        return "relogin";
    }
}
